/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model.map.cell;

/**
 *
 * @author Satrio Dewantono
 */
import java.awt.Image;
import java.io.Serializable;
import model.game.GameInterface;
import model.utility.ImageUtility;


/**
 Cells that can be planted
 */
public class TeleportCell extends Cell implements Serializable {

  /**
   * Teleport destination
   */
  private String teleportdestination;
  private GameInterface gi_;

  /**
   * Constructor
   */
  public TeleportCell(GameInterface game) {
    super(game);
    gi_ = game;

  }

  /**
   * Called upon day transition
   */
  public void advanceDay() {
    return;
  }

  /**
   * Called upon each action
   */
  public void advanceTime() {
    return;
  }

  public void setTeleportDestination(String dest){
    teleportdestination = dest;
  }

  public String getTeleportDestination(){
    return teleportdestination;
  }

  /**
   * Return the image of this cell
   * 64x64
   */
  public Image getImage() {
    if ((gi_.getMaps().getMapContaining(this).isShop())||(gi_.getMaps().getMapContaining(this).isHouse())){
      return ImageUtility.loadImage(
            "resources/pictures/cell/teleport_indoor.png");
    }else{
      return ImageUtility.loadImage(
	      "resources/pictures/cell/teleport.png");
    }
  }

  /**
   * Return whether this cell is enterable by some creature
   */
  public boolean isEnterable() {
    return true;
  }

  /**
   * Return whether this cell is plantable
   */
  public boolean isPlantable() {
    return false;
  }

  /**
   * Return whether this cell is steppable
   */
  public boolean isSteppable() {
    return !(game_.getCreatures().containsUnsteppableCreatureAt(this));
  }

   public boolean isTeleport(){
    return true;
  }

  /**
   * Returns the character represnting this cell
   */
  public static char getRep() {
    return 'T';
  }

}
